package com.app.util.args;

import com.app.util.args.ArgsValidater.ArgType;

public class ArgsDemo {

	public static void main(String[] args) {
		args = new String[] { "e:/jobs/servers.txt", "1", "c:\\", "-c", "-f", "e:/jobs/servers.txt" };
		Args arg = new Args(args);
		ArgsValidater validater = new ArgsValidater();
		validater.addArgs(ArgType.CanWriteFile, "要打开的文件");
		validater.addArgs(ArgType.Number, "打开文件的大小");
		validater.addArgs(ArgType.ExistsFile, "另一个已经存在的文件");
		validater.addOption("-c", ArgType.Number, "文件大小");
		validater.addOption("-f", ArgType.CanWriteFile, true, "文件位置或目录");

		ValidateResult result = validater.check(arg);
		System.out.println(result.isGood());
		System.out.println(result.getMessage());
		System.out.println(validater.toString());
	}

}
 